//
//  HXDPlusMenuButton.swift
//  weibo
//
//  Created by huxuedong on 15/12/12.
//  Copyright © 2015年 huxuedong. All rights reserved.
//

import UIKit

class HXDPlusMenuButton: UIButton {

    //重写highlighted属性，将其置空，取消高亮状态的点击效果
    override var highlighted: Bool {
        set {
        }
        get {
            return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        //设置图片填充模式
        imageView?.contentMode = .Center
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
    }

}
